Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DashboardTimeRangeSlider #1725

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Conversation

bprusinowski
Copy link
Collaborator

@bprusinowski bprusinowski commented Sep 6, 2024

Fixes #1617

This PR fixes a problem of wrong positioning of marks in DashboardTimeRangeSlider. Due to the conversion of dates to milliseconds, and interpolation of values between min and max dates, there were some non-obvious issues with marks positioning. To see one such issue, see this link from TEST and slide through the slider values – see that 2022 and 2023 and extra-close to each other, while they should have the same spacing as previous years.

To fix this issue, I changed the Slider's behavior from continuous to discrete, passing the values that actually appear in the data. It also makes sure that we use combined values from merged date dimension.

How to test

  1. Go to this link.
  2. Add a line chart.
  3. Proceed to layout options.
  4. Enable shared date filter.
  5. ✅ Scroll through the values and see that 2022 and 2023 have equal spacing, as between other years.

Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
visualization-tool ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 0:17am

Copy link
Contributor

@noahonyejese noahonyejese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the dimensions array already memoized via the first useMemo hook? i might be wrong on this one...

Copy link
Contributor

@noahonyejese noahonyejese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✔️

@bprusinowski
Copy link
Collaborator Author

bprusinowski commented Sep 6, 2024

@noahonyejese yep, technically the dimensions should come memoized from the first hook, except when it's still fetching the data; in this case the result could be null, and using ?? [] would force re-calculations of second useMemo on every render 👀 I've moved this part of the logic to second useMemo, I think it's cleaner now, thanks!

Copy link
Contributor

@noahonyejese noahonyejese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Base automatically changed from feat/dashboard-size-preview to main September 6, 2024 12:03
@bprusinowski bprusinowski merged commit 212fb01 into main Sep 6, 2024
2 of 3 checks passed
@bprusinowski bprusinowski deleted the fix/time-range-dashboard-slider branch September 6, 2024 12:09
@KerstinFaye
Copy link

@bprusinowski, looks good. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✅ Dashboard time filter's last option is not displayed correctly
3 participants